using System.Collections.Generic;

namespace GameConfig
{ 
	public static class AssetReader
	{
		// proto数据, 你需要明确知道怎么使用它. 禁止外界修改它的数据!
		public static Asset Asset;

		public static Dictionary<int, Asset.Types.StAssetTemplate> AssetTemplate
		{
			get;
			private set;
		}
		
		private static void Trans()
		{ 
			AssetTemplate = new Dictionary<int, Asset.Types.StAssetTemplate>(Asset.AssetTemplateValue.Count);
			for (int i = 0; i < Asset.AssetTemplateValue.Count; ++i)
			{
				AssetTemplate[Asset.AssetTemplateKey[i]] = Asset.AssetTemplateValue[i];
			}
		}

		public static void Read(byte[] stream)
		{
			Asset = GameConfig.Asset.Parser.ParseFrom(stream);
			Trans();
		}
	}
	public static class GlobalReader
	{
		// proto数据, 你需要明确知道怎么使用它. 禁止外界修改它的数据!
		public static Global Global;

		public static Global.Types.StGlobalConst GlobalConst
		{
			get
			{
				return Global.GlobalConst;
			}
		}
		
		private static void Trans()
		{ 
		}

		public static void Read(byte[] stream)
		{
			Global = GameConfig.Global.Parser.ParseFrom(stream);
			Trans();
		}
	}
	public static class ItemReader
	{
		// proto数据, 你需要明确知道怎么使用它. 禁止外界修改它的数据!
		public static Item Item;

		public static Dictionary<int, Item.Types.StItemTemplate> ItemTemplate
		{
			get;
			private set;
		}
		
		private static void Trans()
		{ 
			ItemTemplate = new Dictionary<int, Item.Types.StItemTemplate>(Item.ItemTemplateValue.Count);
			for (int i = 0; i < Item.ItemTemplateValue.Count; ++i)
			{
				ItemTemplate[Item.ItemTemplateKey[i]] = Item.ItemTemplateValue[i];
			}
		}

		public static void Read(byte[] stream)
		{
			Item = GameConfig.Item.Parser.ParseFrom(stream);
			Trans();
		}
	}
	public static class LanguageReader
	{
		// proto数据, 你需要明确知道怎么使用它. 禁止外界修改它的数据!
		public static Language Language;

		public static Dictionary<string, Language.Types.StLanguageCommon> LanguageCommon
		{
			get;
			private set;
		}
		public static Dictionary<string, Language.Types.StLanguageError> LanguageError
		{
			get;
			private set;
		}
		
		private static void Trans()
		{ 
			LanguageCommon = new Dictionary<string, Language.Types.StLanguageCommon>(Language.LanguageCommonValue.Count);
			for (int i = 0; i < Language.LanguageCommonValue.Count; ++i)
			{
				LanguageCommon[Language.LanguageCommonKey[i]] = Language.LanguageCommonValue[i];
			}
			LanguageError = new Dictionary<string, Language.Types.StLanguageError>(Language.LanguageErrorValue.Count);
			for (int i = 0; i < Language.LanguageErrorValue.Count; ++i)
			{
				LanguageError[Language.LanguageErrorKey[i]] = Language.LanguageErrorValue[i];
			}
		}

		public static void Read(byte[] stream)
		{
			Language = GameConfig.Language.Parser.ParseFrom(stream);
			Trans();
		}
	}
	public static class SceneReader
	{
		// proto数据, 你需要明确知道怎么使用它. 禁止外界修改它的数据!
		public static Scene Scene;

		public static Dictionary<int, Scene.Types.StSceneTemplate> SceneTemplate
		{
			get;
			private set;
		}
		
		private static void Trans()
		{ 
			SceneTemplate = new Dictionary<int, Scene.Types.StSceneTemplate>(Scene.SceneTemplateValue.Count);
			for (int i = 0; i < Scene.SceneTemplateValue.Count; ++i)
			{
				SceneTemplate[Scene.SceneTemplateKey[i]] = Scene.SceneTemplateValue[i];
			}
		}

		public static void Read(byte[] stream)
		{
			Scene = GameConfig.Scene.Parser.ParseFrom(stream);
			Trans();
		}
	}
	public static class SkillReader
	{
		// proto数据, 你需要明确知道怎么使用它. 禁止外界修改它的数据!
		public static Skill Skill;

		public static Dictionary<int, Skill.Types.StSkillTemplate> SkillTemplate
		{
			get;
			private set;
		}
		
		private static void Trans()
		{ 
			SkillTemplate = new Dictionary<int, Skill.Types.StSkillTemplate>(Skill.SkillTemplateValue.Count);
			for (int i = 0; i < Skill.SkillTemplateValue.Count; ++i)
			{
				SkillTemplate[Skill.SkillTemplateKey[i]] = Skill.SkillTemplateValue[i];
			}
		}

		public static void Read(byte[] stream)
		{
			Skill = GameConfig.Skill.Parser.ParseFrom(stream);
			Trans();
		}
	}
	public static class UIReader
	{
		// proto数据, 你需要明确知道怎么使用它. 禁止外界修改它的数据!
		public static UI UI;

		public static Dictionary<string, UI.Types.StUIAsset> UIAsset
		{
			get;
			private set;
		}
		public static Dictionary<string, UI.Types.StUIPrefab> UIPrefab
		{
			get;
			private set;
		}
		
		private static void Trans()
		{ 
			UIAsset = new Dictionary<string, UI.Types.StUIAsset>(UI.UIAssetValue.Count);
			for (int i = 0; i < UI.UIAssetValue.Count; ++i)
			{
				UIAsset[UI.UIAssetKey[i]] = UI.UIAssetValue[i];
			}
			UIPrefab = new Dictionary<string, UI.Types.StUIPrefab>(UI.UIPrefabValue.Count);
			for (int i = 0; i < UI.UIPrefabValue.Count; ++i)
			{
				UIPrefab[UI.UIPrefabKey[i]] = UI.UIPrefabValue[i];
			}
		}

		public static void Read(byte[] stream)
		{
			UI = GameConfig.UI.Parser.ParseFrom(stream);
			Trans();
		}
	}
}
